package com.itheima.dao;

import com.itheima.domain.Car;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
public interface CarDao {
    //@Insert("insert into tbl_book values(null,#{type},#{name},#{description})")
    @Insert("insert into tb_brand (name,brand,description) values(#{name},#{brand},#{description})")
    public int save(Car car);  //返回值表示影响的行数

    @Update("update tb_brand set  name = #{name}, brand = #{brand},description = #{description} where id = #{id}")
    public int update(Car car);

    @Delete("delete from tb_brand where id = #{id}")
    public int delete(Integer id);

    @Select("select * from tb_brand where id = #{id}")
    public Car getById(Integer id);

    @Select("select * from tb_brand")
    public List<Car> getAll();
}
